#!/bin/bash

if [[ $# -ne 1 ]]; then
    echo "The format is as follows:"
    echo "bash tcl-8.5.9.sh buildpath installpath"
    echo ":param installpath: 应用安装绝对路径"
    exit 1
fi

if [[ ! "$1" =~ ^/.* || ! -d "$1" || "$1" = "/" ]]; then echo "请输入正确的安装路径"; exit 1; fi

installpath=$1
if [[ "$1" =~ .*/$ ]]; then installpath=${installpath%/*}; fi

set -e
wget -t 0 -c -P $installpath http://www.ks.uiuc.edu/Research/namd/libraries/tcl8.5.9-linux-arm64-threaded.tar.gz
tar -zxvf $installpath/tcl8.5.9-linux-arm64-threaded.tar.gz -C $installpath && rm -rf $installpath/tcl8.5.9-linux-arm64-threaded.tar.gz
cd $installpath/tcl8.5.9-linux-arm64-threaded

